﻿namespace GX
{
    public class PackageIn : ByteStream, IPackageIn
    {
        private byte _frame;
        private byte _way;
        public PackageIn(int len)
            : base(len)
        {
        }
        public void InitHead(byte[] bytes, int startIndex, int length)
        {
            this.Write(bytes, startIndex, length);
            this.position = 0;
            /**
             * 协议号
             */
            _frame = this.ReadByte();
            _way = this.ReadByte();
        }
        public byte way
        {
            get
            {
                return _way;
            }
        }
        public byte frame
        {
            get
            {
                return _frame;
            }
        }
        public ushort code
        {
            get
            {
                return NetConfig.GetCode(_frame, _way);
            }
        }
    }
}